<?php

namespace app\index\model;

use think\Model;
use think\model\concern\SoftDelete;

class AlbumAudio extends Model
{
    use SoftDelete;
    protected $name = 'car_album_audio'; //表名      默认类型
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $dateFormat = 'Y/m/d H:i:s';
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';
    protected $deleteTime='delete_at';

    public function info() {
        return $this->hasOne(Album::class, 'id', 'superiorId');
    }
    public function logInfo() {
        return $this->hasOne(AlbumAudioLogo::class, 'audioId', 'id');
    }

    public function commentCount() {
        return $this->hasOne(CommentModel::class, 'exchangeId', 'id')->where('type', 4);
    }
}